package com.iti.jets.gpts.main;



import com.iti.jets.gpts.home.CommentsHome;
import com.iti.jets.gpts.home.FeedbackHome;
import com.iti.jets.gpts.home.TranServiceHome;
import com.iti.jets.gpts.home.UserHome;
import com.iti.jets.gpts.pojo.Comments;
import com.iti.jets.gpts.pojo.Feedback;
import com.iti.jets.gpts.pojo.TranService;
import com.iti.jets.gpts.pojo.User;
import java.util.ArrayList;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author noha
 */
public class NohaMain {

    public static void main(String[] args) {
 SessionFactory sessionFactory = new Configuration().configure()
                .buildSessionFactory();
        //////////////////////////////////////DAOS/////////////////////////////////////////////  
        TranServiceHome TranServiceDAO = new TranServiceHome(sessionFactory);
        UserHome userDAO = new UserHome(sessionFactory);
        FeedbackHome feedDAO = new FeedbackHome(sessionFactory);
        CommentsHome commentDAO = new CommentsHome(sessionFactory);
        //////////////////////////////////Create user///////////////////////////////////////////////  
        User objectuser = new User();
        objectuser.setId(1);
        objectuser.setEmail("nohagamal@yahoo.com");
        objectuser.setPassword("123456");
        objectuser.setIsAdmin(Boolean.FALSE);
        userDAO.create(objectuser);
   /*     ///////////////////////////////////////Delete user/////////////////////////////////////////////////
        User object = userDAO.read(1);
        userDAO.delete(object);
        //////////////////////////////////////Create feedback to transservice number 1 to userid=1////////////////////////////////////////////////////////////     
        TranService transobject = TranServiceDAO.read(1);
        Feedback feedobj = new Feedback(1, transobject, objectuser);
        feedobj.setRating(10);
        feedDAO.create(feedobj);
        //////////////////////////////////////Delete Feedback/////////////////////
        Feedback objectfeed = feedDAO.read(1);
        feedDAO.delete(objectfeed);
        //////////////////////////////////////Create Comment to transservice number 1 to userid=1////////////////////////////////////
        Comments commentobj = new Comments(1, transobject, objectuser, "so good");
        commentDAO.create(commentobj);
         //////////////////////////////////////Delete comment/////////////////////
        Comments objectcomment = commentDAO.read(1);
        commentDAO.delete(objectcomment); 
        ///////////////////////////////////get comments by trans ID///////////////////////////////////////////
         ArrayList<Comments> comments = new ArrayList<Comments>();
        comments=(ArrayList<Comments>) commentDAO.getCommentsByTranService(transobject.getId());
        */
    }
}
